/**
 * 
 */
package aiproject3.agents;

import aiproject3.models.Bigram;
import aiproject3.models.Gaussian;
import aiproject3.models.KnowledgeBase;
import aiproject3.models.Trigram;
import aiproject3.models.Unigram;
import aiproject3.predictors.ANNPredictor;
import aiproject3.predictors.DistributionPredictor;
import aiproject3.predictors.MajorityPredictor;
import aiproject3.predictors.NGramPredictor;
import aiproject3.predictors.Predictor;
import aiproject3.agents.TrainingAgent;

/**
 * @author Chris
 *
 */
public class AgentFactory {

	public static enum PredictorType {
		Majority, NGramPredictor, DistributionPredictor, ANNPredictor
	};
	
	public static enum ModelType {
		Unigram, Bigram, Trigram, Gaussian
	};

	@SuppressWarnings("unchecked")
	public TrainingAgent createAgent(ModelType modelType, PredictorType predictorType, String trainingFile) {
		TrainingAgent agent = null;
		KnowledgeBase model = null;
		Predictor predictor = null;
		
		switch (modelType) {
		case Unigram:
			model = new Unigram();
			break;
		case Bigram:
			model = new Bigram();
			break;
		case Trigram:
			model = new Trigram();
			break;
		case Gaussian:
		    model = new Gaussian();
		    break;
		default:
			break;
		}
		switch (predictorType) {
		case Majority:
			predictor = new MajorityPredictor(model);
			break;
		case NGramPredictor:
			predictor = new NGramPredictor(model);
			break;
		case DistributionPredictor:
		    predictor = new DistributionPredictor(model);
		    break;
		case ANNPredictor:
		    predictor = new ANNPredictor();
		default:
			break;
		}
		agent = new TrainingAgent(model, predictor);
		agent.train(trainingFile);
		return agent;
	}
	
}
